import { Subject } from 'rxjs';
import { ContactState, DirectionType } from '../common/commlib.enums';
import {
  IContact,
  IEvent,
  IError,
  IDevice,
  IMessageParams
} from '../common/commlib.interfaces';

export abstract class Contact implements IContact {
  protected fromAddress: any;
  protected queueName: string;
  protected state: ContactState;
  protected createdAt: Date;
  protected createdBy: any;
  protected connectedAt: Date;
  protected endedAt: Date;
  protected endedBy: any;
  protected users: any[] = [];

  public onNewEvent$ = new Subject<IEvent>();
  public onError$: Subject<IError> = new Subject<IError>();

  public getId(): string {
    return this.id;
  }

  public getFromAddress(): any {
    return this.fromAddress;
  }

  public getState(): ContactState {
    return this.state;
  }

  public getDevice(): IDevice {
    return this.device;
  }

  public getCreatedAt(): Date {
    return this.createdAt;
  }

  public getCreatedBy(): any {
    return this.createdBy;
  }

  public getEndedAt(): Date {
    return this.endedAt;
  }

  public getEndedBy(): any {
    return this.endedBy;
  }

  public getConnectedAt(): Date {
    return this.connectedAt;
  }

  public getQueueName(): any {
    return this.queueName;
  }

  public getUsers(): any[] {
    return this.users;
  }

  public abstract accept(): any;
  public abstract decline(): any;
  public abstract hold(): any;
  public abstract unHold(): any;
  public abstract mute(): any;
  public abstract unMute(): any;
  public abstract hangup(): any;
  public abstract sendMessage(messageParams: IMessageParams): any;
  public abstract getPreviousMessages(parameters: any): any;
  public abstract getDirection(): DirectionType;
  public abstract typing(parameters?: any): any;

  constructor(
    protected id: string,
    protected device: IDevice,
    protected rawContact?: any
  ) {
    //
  }
}
